//
//  RootViewControllerTest.m
//  WindowTest
//
//  Created by wangrui on 13-10-16.
//  Copyright (c) 2013年 PPS. All rights reserved.
//

#import "RootViewControllerTest.h"

@interface RootViewControllerTest ()

@end

@implementation RootViewControllerTest

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)dealloc{
    
}

- (void)viewDidLoad
{
    [super viewDidLoad];

    self.view.backgroundColor = [UIColor lightGrayColor];
    
    UIButton *bt = [UIButton buttonWithType:UIButtonTypeCustom];
    bt.backgroundColor = [UIColor blueColor];
    bt.frame = CGRectMake(0, 0, 50, 50);
    bt.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin|UIViewAutoresizingFlexibleTopMargin|UIViewAutoresizingFlexibleLeftMargin
    |UIViewAutoresizingFlexibleRightMargin;
    bt.center = self.view.center;
    [bt addTarget:self action:@selector(hideMyWindow:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:bt];
}

- (void)hideMyWindow:(id)sender{
    self.view.window.hidden = YES;
    NSLog(@"window superView:%@",self.view.window.superview);
    //[self.view.window removeFromSuperview];
}


- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{
    NSLog(@"rotate: %@",NSStringFromCGRect(self.view.frame));
    
    NSLog(@"addwindow subview:%@",self.view.window.subviews);

}



@end
